package org.example.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.example.pojo.User;

public interface UserMapper {
    /**
     * 获取用户
     * @param username
     * @param password
     * @return
     */
    @Select("select * from user where username=#{username} and password = #{password}")
    User select(@Param("username") String username, @Param("password") String password);

    /**
     * 根据用户名查询对象
     * @param username
     * @return
     */
    @Select("select * from user where username=#{username}")
    User selectUser(String username);

    /**
     * 插入数据
     * @param user
     */
    @Select("insert into user values (null,#{username},#{password})")
    void insert(User user);
}
